The present invention relates to a method of compressing a MIDI file. The field of the invention is that of appliances, usually portable appliances, which have limited memory capacity and computation power. The limitation can stem from the overall size of the appliance compared to the resources needed to reproduce a MIDI file as sound. However, the limitation can also stem from the quantity of resources that the appliance can allocate to reproducing a MIDI file as sound. The appliances referred to include mobile telephones and electronic organizers. The object of the invention is to improve the sound performance of appliances in the above-defined field. Another object of the invention is to make it easy to create and modify complex melodies that can be played by the appliances in that field.
Mobile telephones having monophonic sound reproducing capabilities are known in the art. The melody played by a mobile telephone, either as ringing or on some other occasion, is a succession of sounds having a particular duration and a frequency. The same timbre is retained, however. A pure sinusoid is fed to an electro-acoustic appliance that reproduces it. The resulting metallic or electronic sounds are often very far removed from the work which served as a model for the melody.
The obvious solution to the above problem would be to store the melodies that the mobile telephone is required to play in its memory in a format that is used on compact discs, for example. The problem associated with that solution is that of memory space. A sampled format is very greedy in terms of memory space. In addition to this there is the current trend to offer more and more melodies on a mobile telephone. That trend is justified by the fact that the number of mobile telephones in use is increasing and it must be possible to tell which mobile telephone is ringing. There is therefore an incompatibility between the obvious solution and technical imperatives.
Added to this is the difficulty of modifying a sampled file. All the sounds are mixed together without it being possible to distinguish one from the other in the record in the file. If the above solution were chosen, it would therefore be impossible for a normal mobile telephone user to adapt a melody to suit their tastes.
The above problems could be solved by having the mobile telephone play a MIDI file, for example. There are a great many MIDI files that can very easily be generated and manipulated by a user having a fairly rudimentary knowledge of music. It would be desirable to be able to store the greatest possible number of MIDI files in a mobile telephone, to give the user the greatest possible choice of melodies. However, MIDI files require a greater memory capacity and a more powerful processor than are available in portable appliances.
The invention solves this problem by compressing the MIDI files.
To be more precise, the invention provides a method of compressing a MIDI file, the method including an EVENT step consisting in:
scanning the MIDI file to seek a start event and its associated end event, and
replacing the pair thus found by a single event limited in time.
The single event has exactly the same effect as the pair, but the size of the single event is less than that of the pair. This transformation of the original MIDI file is totally reversible in terms of sound output.
In particular, in the method the start event is a xe2x80x9cNoteOnxe2x80x9d event defined by the MIDI standard and the associated end event is a xe2x80x9cNoteOffxe2x80x9d event defined by the MIDI standard.
Advantageously, the method further includes a POLY step consisting in:
defining the necessary resources, in terms of memory and computing power, for playing a note on a given instrument,
defining the resources of the reproduction means available for playing a MIDI file,
structuring a memory table to define relative priorities of instruments,
detecting in the MIDI file instances of polyphony which exceed the capabilities of the reproduction means,
determining the resources to be used to reproduce a note, and
eliminating from a detected instance of polyphony as many notes corresponding to instruments of the lowest relative priority of those contributing to the polyphony as are necessary to reduce the polyphony to a level acceptable by the reproduction means.
The method preferably further includes a BAND step consisting in:
determining the bandwidth that an appliance can reproduce, and
eliminating notes which are outside the reproduction capacities of the appliance.
The EVENT, POLY, and BAND steps can be effected in any order.